﻿@model IEnumerable<Sys_MenuAction>
@foreach (var item in Model.Where(o => o.A_PId == 0))
{
    <li name="menu">
        <a href="###" class="dropdown-toggle">
            <i class="menu-icon fa @item.A_Icon"></i>
            <span class="menu-text">
                @item.A_Title
                @if (!string.IsNullOrEmpty(item.A_Memo))
                {
                    <!-- #section:basics/sidebar.layout.badge -->
                    <span class="badge badge-transparent tooltip-error" title="item.A_Memo">
                        <i class="ace-icon fa fa-exclamation-triangle red bigger-130"></i>
                    </span>
                    <!-- /section:basics/sidebar.layout.badge -->
                }
            </span>
            <b class="arrow fa fa-angle-down"></b>
        </a>
        @{
            var sublist = Model.Where(o => o.A_PId == item.A_Id);
            if (sublist.Any())
            {
                <b class="arrow"></b>
                    <ul class="submenu">
                        @foreach (var sub in Model.Where(o => o.A_PId == item.A_Id))
                        {

                            <li>
                                <a href="@($"/{sub.A_Controller}/{sub.A_Action}")" name="am">
                                    <i class="menu-icon fa fa-caret-right"></i>
                                    @sub.A_Title
                                </a>
                            </li>
                        }
                    </ul>
            }
        }
    </li>
}
